﻿using System;

using NUnit.Framework;

using octalforty.Syndication.Core.Rss;

namespace octalforty.Syndication.UnitTests.Core.Rss
{
    /// <summary>
    /// <see cref="RssChannel"/> unit tests.
    /// </summary>
    [TestFixture()]
    public class RssChannelTestFixture : RssEntityBaseTestFixture
    {
        [Test()]
        public void NoArgumentConstructor()
        {
            RssChannel rssChannel = new RssChannel();

            Assert.IsEmpty(rssChannel.Copyright);
            Assert.IsEmpty(rssChannel.Generator);
            Assert.IsEmpty(rssChannel.Items);
            Assert.IsEmpty(rssChannel.Language);
            Assert.IsNull(rssChannel.ManagingEditor);

            Assert.IsNull(rssChannel.TimeToLive);
            Assert.IsEmpty(rssChannel.Title);

            Assert.IsNotNull(rssChannel.UpdatedOn);
            Assert.IsTrue(DateTime.Now.Subtract(rssChannel.UpdatedOn.Value).TotalSeconds < 1);

            Assert.IsNull(rssChannel.WebMaster);
        }

        #region RssEntityBaseTestFixture Members
        /// <summary>
        /// When overriden in a derived class, creates an instance of <see cref="RssEntityBase"/>.
        /// </summary>
        /// <returns></returns>
        protected override RssEntityBase CreateInstance()
        {
            return new RssChannel();
        }
        #endregion
    }
}
